package D240425;


import java.util.Random;
import java.util.Scanner;

public class Rps {
    static private String[] status = new String[]{"Rock", "Paper", "Scissors"};
    static private String[][] judgement = new String[][]{
            {"平局！", "你赢了！", "你输了！"},
            {"你赢了！", "平局！", "你输了！"},
            {"你输了！", "你赢了！", "平局"}
    };
    static private int playerStatus;
    static private int computerStatus;

    public static void setPlayerStatus() {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入你的选择：（rock，paper，scissors）");
        String player = scanner.nextLine();
        boolean areEqual;
        for (int i = 0; i < status.length; i++) {
            areEqual = player.equalsIgnoreCase(status[i]);
            if (areEqual) {
                playerStatus = i;
                break;
            } else if (i == 3) {
                System.out.println("请输入正确选项！");
                System.exit(0);
            }
        }
        System.out.println("你的选择是：" + status[playerStatus]);
    }

    public static void setComputerStatus(){
        Random random = new Random();
        computerStatus = random.nextInt(3);
        System.out.println("电脑出的是：" + status[computerStatus]);
    }

    public static void judge(){
        System.out.println(judgement[playerStatus][computerStatus]);
    }
}


